import React, { PureComponent } from 'react';
import { connect } from 'dva';
import CardC from '../../Barra/comps/cardC';
import ValuationTable from '../../../systemManagement/valuationAnalysis';
import style from './index.less';

@connect(({ loading }) => ({
  loading,
}))
export default class ValuationAnalysis extends PureComponent {
  componentDidMount() {
    this.props.onRef && this.props.onRef(this);
  }

  // 结果查询页面切换
  changeResultPage = (refresh, infoDetail, type) => {
    this.props.showResultPage(false, infoDetail, type);
  };

  onRefresh = () => {
    this.valuationTableRef.getTableData();
  };

  render() {
    const { trandingCode, trandingName, dimension } = this.props;
    return (
      <div className={style.valuation}>
        {/* 展开 */}
        <CardC title='估值解析' type='32' showContent={true} titleIsShow={false} />
        <div className={style.table}>
          <ValuationTable
            pageType='2'
            onRef={(ref) => (this.valuationTableRef = ref)}
            changeResultPage={this.changeResultPage}
            trandingCode={trandingCode}
            trandingName={trandingName}
            dimension={dimension}
          />
        </div>
      </div>
    );
  }
}
